package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Interface;
import com.briup.recognition.bean.InterfaceExample;
import com.briup.recognition.dao.InterfaceMapper;
import com.briup.recognition.service.InterfaceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class InterfaceServiceImpl implements InterfaceService {

    @Resource
    private InterfaceMapper interfaceMapper;

    @Override
    public List<Interface> query() {
        InterfaceExample example=new InterfaceExample();

        return interfaceMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(Interface interfaces) {
        if (interfaces.getId()!=null){
            interfaceMapper.updateByPrimaryKey(interfaces);
        }else {
            interfaceMapper.insert(interfaces);
        }
    }


    @Override
    public void deleteById(long id) {
        interfaceMapper.deleteByPrimaryKey(id);
    }
}
